import Vue from 'vue'

import 'normalize.css/normalize.css' // 初始化css样式

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // 导入element-ui组件库的英文包

import '@/styles/index.scss' // 导入了全局的样式文件

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // 导入权限控制(路由导航守卫)
// import '@/directives'
// 测试端口
// import http from '@/utils/request'
// Vue.prototype.request = http

// 批量导入所有指令并注册
import * as allDirectives from '@/directives'
import Mycomponents from '@/components/index'
// ----------------------------------------------------------------
// 批量导入所有过滤器
import * as allFilters from '@/filters'
// console.log(allFilters)
Object.keys(allFilters).forEach(item => {
  // console.log(allFilters[item])
  Vue.filter(item, allFilters[item])
})
// -----------------------------------------------------------------
// console.log(allDirectives)
// 使用for in 循环遍历
// for (const k in allDirectives) {
//   // console.log(k)
//   // console.log(allDirectives[k])
//   Vue.directive(k, allDirectives[k])
// }
// Object.keys可以将对象的键收集到一个数组中
Object.keys(allDirectives).forEach(item => {
  Vue.directive(item, allDirectives[item])
})
// 设置为英文语言
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)
Vue.use(Mycomponents)

Vue.config.productionTip = false

new Vue({

  router,
  store,
  render: h => h(App)
}).$mount('#app')
